package org.dreamwork.jasmine2.restful;

import com.google.gson.annotations.Expose;

/**
 * Created with IntelliJ IDEA.
 * User: seth.yang
 * Date: 14-11-20
 * Time: 下午11:31
 */
public class ResultFieldDefinition {
    @Expose
    private String name;
    @Expose
    private String type;
    @Expose
    private String description;
    @Expose
    private boolean mandatory = false;

    public String getName () {
        return name;
    }

    ResultFieldDefinition setName (String name) {
        this.name = name;
        return this;
    }

    public String getType () {
        return type;
    }

    ResultFieldDefinition setType (String type) {
        this.type = type;
        return this;
    }

    public String getDescription () {
        return description;
    }

    ResultFieldDefinition setDescription (String description) {
        this.description = description;
        return this;
    }

    public boolean isMandatory () {
        return mandatory;
    }

    ResultFieldDefinition setMandatory (boolean mandatory) {
        this.mandatory = mandatory;
        return this;
    }

    @Override
    public boolean equals (Object o) {
        if (this == o) return true;
        if (o == null || getClass () != o.getClass ()) return false;

        ResultFieldDefinition that = (ResultFieldDefinition) o;

        return name != null && name.equals (that.name);
    }

    @Override
    public int hashCode () {
        return name != null ? name.hashCode () : 0;
    }
}